package com.qf.controller;

import com.alibaba.excel.EasyExcel;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qf.entity.Prescription;
import com.qf.service.PrescriptionService;
import com.sun.deploy.net.URLEncoder;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
import com.qf.util.R;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 处方表格，用于记录患者的处方信息(Prescription)表控制层
 *
 * @author makejava
 * @since 2024-12-03 21:52:04
 */
@RestController
@RequestMapping("/md/unit")
public class PrescriptionController {
    /**
     * 服务对象
     */
    @Autowired
    private PrescriptionService prescriptionService;

    //查询所有处方列表
    @GetMapping("/list")
    public R queryAllPrescription(Prescription prescription) {
        PageHelper.startPage(prescription.getPageNum(),prescription.getPageSize());

        List<Prescription> list = prescriptionService.list(prescription);

        PageInfo<Prescription> pageInfo = new PageInfo<>(list);

            return R.ok(pageInfo);
    }
}

